package com.zhongxin.wymovieticketfragment;

import java.util.List;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import com.zhongxin.wymovieticket.R;
import com.zhongxin.wymovieticket.adapter.ChangeModeImageAdapter;
import com.zhongxin.wymovieticket.getdata.DataStore;
import com.zhongxin.wymovieticketentity.HotMovies;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Gallery;

public class ChangeModeFragment extends Fragment {

	private Gallery gallery;
	private ChangeModeImageAdapter chaImageAdapter;
	private RequestQueue queue;

	public ChangeModeFragment() {
		// TODO Auto-generated constructor stub
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub

		View view = inflater.inflate(R.layout.fragment_changemode, container,
				false);
		queue = Volley.newRequestQueue(getActivity());
		gallery = (Gallery) view.findViewById(R.id.changemode_gallery);
		List<HotMovies> hotMovies = DataStore.getInstance().getTextEntities();
		System.out.println(hotMovies.size());
		chaImageAdapter = new ChangeModeImageAdapter(hotMovies, queue,
				getActivity());
		gallery.setAdapter(chaImageAdapter);
		return view;
	}

}
